import greenfoot.*;  // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)

/**
 * Write a description of class Bandera here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class Bander extends Objeto
{
    /**
     * Act - do whatever the Bandera wants to do. This method is called whenever
     * the 'Act' or 'Run' button gets pressed in the environment.
     */
    public Bander()
    {
        GreenfootImage image =getImage();
        image.scale(70,70);
        setImage(image);
        setLocation(760,616);
    }
   public void act() 
    {
        
        if(checkaInterseccion())
        {
            despliega("WINNER");
            
            Greenfoot.delay(100);
            
            ((FlagWarWorld)getWorld()).records();
            
            
            //getWorld().removeObject(this);
            
        }
        // Add your action code here.
    }    
     public void despliega(String mensaje)
    {
        setLocation(400,275);
        super.setImage(
        new GreenfootImage(mensaje,100,
        java.awt.Color.YELLOW,
        java.awt.Color.BLACK)
        );
    }
        public boolean checkaInterseccion()
    {
        
       if (getOneIntersectingObject(Hero.class) != null || getOneIntersectingObject(Body.class) != null )
        {
         return true;
           
           
            
        }
        else
         
        return false;
        
    }
}


